<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Sets mouse options</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.ncurses-mousemask" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ncurses_mousemask</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.2.0, PHP 5 &lt; 5.3.0, PECL ncurses &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">ncurses_mousemask</span> &mdash; <span class="dc-title">Sets mouse options</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.ncurses-mousemask-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>ncurses_mousemask</strong></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$newmask</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter reference">&$oldmask</code></span>
   ) : <span class="type">int</span></div>

  <div class="warning"><strong class="warning">Warning</strong><p class="simpara">此函数是<em class="emphasis">实验性</em>的。此函数的表象，包括名称及其相关文档都可能在未来的
PHP 发布版本中未通知就被修改。使用本函数风险自担 。</p></div>
  <p class="para">
   Sets mouse events to be reported. By default no mouse events will be
   reported.
  </p>
  <p class="para">
   Mouse events are represented by <strong><code>NCURSES_KEY_MOUSE</code></strong> in the
   <span class="function"><a href="ncurses_wgetch.html" class="function">ncurses_wgetch()</a></span> input stream. To read the event data
   and pop the event of queue, call <span class="function"><a href="ncurses_getmouse.html" class="function">ncurses_getmouse()</a></span>.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.ncurses-mousemask-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">newmask</code></dt>

     <dd>

      <p class="para">
       Mouse mask options can be set with the following predefined constants:
       <ul class="itemizedlist">
        <li class="listitem"><p class="para">NCURSES_BUTTON1_PRESSED</p></li>
        <li class="listitem"><p class="para">NCURSES_BUTTON1_RELEASED</p></li>
        <li class="listitem"><p class="para">NCURSES_BUTTON1_CLICKED</p></li>
        <li class="listitem"><p class="para">NCURSES_BUTTON1_DOUBLE_CLICKED</p></li>
        <li class="listitem"><p class="para">NCURSES_BUTTON1_TRIPLE_CLICKED</p></li>
        <li class="listitem"><p class="para">NCURSES_BUTTON2_PRESSED</p></li>
        <li class="listitem"><p class="para">NCURSES_BUTTON2_RELEASED</p></li>
        <li class="listitem"><p class="para">NCURSES_BUTTON2_CLICKED</p></li>
        <li class="listitem"><p class="para">NCURSES_BUTTON2_DOUBLE_CLICKED</p></li>
        <li class="listitem"><p class="para">NCURSES_BUTTON2_TRIPLE_CLICKED</p></li>
        <li class="listitem"><p class="para">NCURSES_BUTTON3_PRESSED</p></li>
        <li class="listitem"><p class="para">NCURSES_BUTTON3_RELEASED</p></li>
        <li class="listitem"><p class="para">NCURSES_BUTTON3_CLICKED</p></li>
        <li class="listitem"><p class="para">NCURSES_BUTTON3_DOUBLE_CLICKED</p></li>
        <li class="listitem"><p class="para">NCURSES_BUTTON3_TRIPLE_CLICKED</p></li>
        <li class="listitem"><p class="para">NCURSES_BUTTON4_PRESSED</p></li>
        <li class="listitem"><p class="para">NCURSES_BUTTON4_RELEASED</p></li>
        <li class="listitem"><p class="para">NCURSES_BUTTON4_CLICKED</p></li>
        <li class="listitem"><p class="para">NCURSES_BUTTON4_DOUBLE_CLICKED</p></li>
        <li class="listitem"><p class="para">NCURSES_BUTTON4_TRIPLE_CLICKED</p></li>
        <li class="listitem"><p class="para">NCURSES_BUTTON_SHIFT&gt;</p></li>
        <li class="listitem"><p class="para">NCURSES_BUTTON_CTRL</p></li>
        <li class="listitem"><p class="para">NCURSES_BUTTON_ALT</p></li>
        <li class="listitem"><p class="para">NCURSES_ALL_MOUSE_EVENTS</p></li>
        <li class="listitem"><p class="para">NCURSES_REPORT_MOUSE_POSITION</p></li>
       </ul>
      </p>
      <p class="para">
       As a side effect, setting a zero mousemask in
       <code class="parameter">newmask</code> turns off the mouse
       pointer. Setting a non zero value turns mouse pointer on.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">oldmask</code></dt>

     <dd>

      <p class="para">
       This will be set to the previous value of the mouse event mask.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.ncurses-mousemask-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns the mask of reportable events. On complete failure, it returns
   <em>0</em>.
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.ncurses-mousemask-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-683">
    <p><strong>Example #1 <span class="function"><strong>ncurses_mousemask()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$newmask&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">NCURSES_BUTTON1_CLICKED&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">NCURSES_BUTTON1_RELEASED</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$mask&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ncurses_mousemask</span><span style="color: #007700">(</span><span style="color: #0000BB">$newmask</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$oldmask</span><span style="color: #007700">);<br />if&nbsp;(</span><span style="color: #0000BB">$mask&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">$newmask</span><span style="color: #007700">){<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"All&nbsp;specified&nbsp;mouse&nbsp;options&nbsp;will&nbsp;be&nbsp;supported\n"</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.ncurses-mousemask-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="ncurses_getch.html" class="function" rel="rdfs-seeAlso">ncurses_getch()</a> - Read a character from keyboard</span></li>
    <li class="member"><span class="function"><a href="ncurses_getmouse.html" class="function" rel="rdfs-seeAlso">ncurses_getmouse()</a> - Reads mouse event</span></li>
    <li class="member"><span class="function"><a href="ncurses_ungetmouse.html" class="function" rel="rdfs-seeAlso">ncurses_ungetmouse()</a> - Pushes mouse event to queue</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>